<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>

<%@include file="/common/taglibs.jsp" %>
<%@include file="/common/javascript.jsp" %>

<html>
<head>
<meta charset="utf-8">
<title>市区统计详情</title>
    <style type="text/css">	
		/*提交表单*/
		.l-table-edit {font-size:12px; color:#555; padding:5px 5px 5px 0px;}
		.l-table-edit-td{ padding:5px; padding-left:0;}
	</style>
    
    <script type="text/javascript">
    	var viewType='${viewType}';
    	var landType='${model.landType}';
    	var strPoints='${model.points}';
    	var strlng='${model.lon}';
    	var strlat='${model.lat}';
    	var isSelectedMap=true;
    	var markerName='${model.markerName}';
		$(function(){
			if(viewType=="add"){
				$("#houseArea").val("");
				$("#totalarea").val("");
				$("#totalts").val("");
				$("#totalbuilding").val("");
				$("#ytparea").val("");
				$("#ytpts").val("");
				$("#ysarea").val("");
				$("#ysts").val("");
				$("#averageprice").val("");
				isSelectedMap=false;
			}else if(viewType=="detail"){
				$("form input").attr("readonly","readonly"); 
				$("form textarea").attr("readonly","readonly");
				$("form select").attr("disabled", "disabled"); 
			}
			
			if(viewType=="add"){
				landType='1';
				markerName="1.png";
				isSelectedMap=false;
			}
			
			$("#comlt").bind('change',function(){
				landType=$("#comlt").val();
				isSelectedMap=false;
			});
			
			$("#location").bind('click',function(){
		    	if(landType=='1'){//添加点状地块
		    		var url="mapAction_getLoc?viewType="+viewType+"&operateType=getloc&type=1"
		    			+"&cityStatistics.lon="+strlng+"&cityStatistics.lat="+strlat+"&markerName="+markerName;
					var title='获取地块坐标';
					window.parent.openMap(url,title);
		    	}else{
		    		var url="mapAction_getLoc?viewType="+viewType
		    			+"&operateType=getPolygon&type=1&cityStatistics.points="+strPoints
		    			+"&cityStatistics.lon="+strlng+"&cityStatistics.lat="+strlat;
					var title='获取地块坐标';
					window.parent.openMap(url,title);
		    	}
				
				$("#content").dialog('open');
			});
		});
		
		function saveInfo(){
			if(mainform.check()){
				if(!isSelectedMap){
					$.messager.alert('提示',"请先从地图上获取地块位置","info");
					return;
				}
				$("#mainform").form('submit',{
					url:'cityAction_save?lon='+strlng+'&lat='+strlat
						+'&model.points='+strPoints+'&model.markerName='+markerName,
					success: function(data){  
						var data = eval('(' + data + ')'); 
						if (!data.success){ //保存失败  
							$.messager.alert('提示',"错误"+data.message,"info");
        				}else{//保存成功
        					$.messager.alert('提示',data.message,"info",function(){
        						//调用父窗体的方法，关闭弹出框，并刷新网格
        						window.parent.closeContent();
        					});
        				} 
					}
				});
			}
        }
        
        function setLonlat(e){
        	strlng=e.point.lng;
        	strlat=e.point.lat;
        	isSelectedMap=true;
        }
        
        function setArea(str,center){
        	strPoints=str;
        	strlng=center.lng;
        	strlat=center.lat;
        	isSelectedMap=true;
        }
        function modifyMarker()
		{
			var url="mapAction_modifyMarker";
			var title='修改图标';
			window.parent.openMarker(url,title);
		}
		
		function setMarkerName(e){
			if(typeof(e) != "undefined"){
				markerName=e;
				$("#marker").attr('src','images/marker/'+e);
			}
		}
	</script>
</head>

<body style="margin:0px; overflow-style:clear; padding:0px; overflow: auto;">
	<form name="mainform" method="post"  id="mainform"> 
    	<table cellpadding="0" cellspacing="0" class="l-table-edit" style="width: 96%; margin-top:0px; margin-left:15px; column-gap:5px">
        	<tr>
            	<td align="right" class="l-table-edit-td"><label class="red">*</label>编号:</td>
                <td align="left" class="l-table-edit-td">
                	<c:if test="${viewType=='detail' }">
                		${ model.num }
                	</c:if>
                	<c:if test="${viewType!='detail' }">
                		<input name="model.num" id="num"  value="${ model.num}" datatype="*" altercss="gray" tip="请填写编号" />
                	</c:if>
                	<input name="model.cid" type="hidden" id="id" value="${ model.cid}" />
                </td>
                <td align="right" class="l-table-edit-td"><label class="red">*</label> 创建时间:</td>
                <td align="left" class="l-table-edit-td">
                	<c:if test="${viewType!='add' }">
                		<s:date name="model.dateCre"  format="yyyy-MM-dd"/>
                	</c:if>
                	<c:if test="${viewType=='add' }">
                		<input name="model.dateCre" type="text" class="Wdate" onclick="WdatePicker({skin:'whyGreen'})"
                			value='<s:date name="model.dateCre" format="yyyy-MM-dd"/>'/>
                	</c:if>
                </td>
            </tr>
            <tr>
            	<td align="right" class="l-table-edit-td"><label class="red">*</label>项目名称:</td>
                <td align="left" class="l-table-edit-td">
                	<input name="model.name" type="text" id="name" value="${model.name }" datatype="*" altercss="gray" tip="请填写项目名称" />
                </td>
                <td align="right" class="l-table-edit-td">楼盘状态:</td>
                <td align="left" class="l-table-edit-td">
                	<select name="model.p_status" style="width: 150px;"> 
                	<option value="1" <s:if test="model.p_status==1"> selected </s:if>="">在售</option> 
                	<option value="2" <s:if test="model.p_status==2"> selected </s:if>="">待售</option> 
                	<option value="3" <s:if test="model.p_status==3"> selected </s:if>="">售完</option> 
                	<option value="4" <s:if test="model.p_status==4"> selected </s:if>="">在租</option> 
                	</select>
                </td>
            </tr>
            <tr>
            	<td align="right" class="l-table-edit-td">行政区域:</td>
                <td align="left" class="l-table-edit-td">
                	<select id="regionId" class="easyui-combobox" name="regionId" style="width: 155px;">
            		<c:forEach items="${regions}" var="region">
            			<c:choose>
            				<c:when test="${model.regionId.id eq region.id}">
            					<option value="${region.id}" selected="selected">${region.name}</option>
            				</c:when>
            				<c:otherwise>
            					<option value="${region.id}">${region.name}</option>
            				</c:otherwise>
            			</c:choose>
            		</c:forEach>
				</select> 
                </td>
                <td align="right" class="l-table-edit-td"><label class="red">*</label>地块类型:</td>
                <td align="left" class="l-table-edit-td">
                	<select name="model.landType" id="comlt" style="width:150px;">
                		<option value="1" <s:if test="model.landType==1"> selected </s:if>>点状地块</option>
                		<option value="2" <s:if test="model.landType==2"> selected </s:if>>块状地块</option>
                	</select>
                	<a id="location" class="easyui-linkbutton" data-options="plain:'false'" style="text-align:center">获取地块</a>
                	<c:if test="${viewType=='add' }">
                		<a class="easyui-linkbutton" data-options="plain:'false'" style="text-align:center">
                		<img id="marker" name="marker" style="height: 25px;" src="images/marker/1.png"
                		 onclick="modifyMarker()"></a>
                	</c:if>
                	<c:if test="${viewType=='modify' && model.landType=='1' }">
                		<a class="easyui-linkbutton" data-options="plain:'false'" style="text-align:center">
                		<img id="marker" name="marker" style="height: 25px;" src="images/marker/${model.markerName}" 
                			onclick="modifyMarker()"></a>
                	</c:if>
                </td>
            </tr>
            <tr>
            	<td align="right" class="l-table-edit-td"><label class="red">*</label>开发公司:</td>
                <td align="left" class="l-table-edit-td">
                	<input type="text"  name="model.company" id="company" value="${model.company }" datatype="*"  altercss="gray" tip="请填写开发公司"/>
                </td>
                
                <td align="right" class="l-table-edit-td"><label class="red">*</label>物业类型:</td>
                <td align="left" class="l-table-edit-td">
                	<select name="model.type" style="width:150px;">
                	<s:iterator value="useTypes" >
                	 <option value='<s:property value="key" />' <s:if test="key==model.type">selected </s:if>><s:property value="value"/><s:property value="#iType"/></option>
                	</s:iterator>
                	</select>
                </td>
            </tr>
             <tr>
           	 	<td align="right" class="l-table-edit-td"><label class="red">*</label>户型:</td>
                <td align="left" class="l-table-edit-td">
                	<input type="text"  name="model.houseType" id="housetype" value="${model.houseType }" datatype="*"  altercss="gray" tip="请填写户型"/>
                </td>
            	<td align="right" class="l-table-edit-td"><label class="red">*</label>户型面积:</td>
                <td align="left" class="l-table-edit-td">
                	<input type="text"  name="model.houseArea" id="houseArea" value="${model.houseArea }" 
                		datatype="d" altercss="gray" tip="请填写户型面积(数字)"/>平米
                </td>
            </tr>
             <tr>
             	<td align="right" class="l-table-edit-td"><label class="red">*</label>总套数:</td>
                <td align="left" class="l-table-edit-td">
                	<input type="text"  name="model.totalTs" id="totalts" value="${model.totalTs }" datatype="n" altercss="gray" tip="请填写总套数(整数)"/>
                </td>
           	 	<td align="right" class="l-table-edit-td"><label class="red">*</label>总建面:</td>
                <td align="left" class="l-table-edit-td">
                	<input type="text"  name="model.totalArea" id="totalarea" value="${model.totalArea }"
                	 datatype="d" altercss="gray" tip="请填写总建面(数字)"/>平米
                </td>
            </tr>
             <tr>
           	 	<td align="right" class="l-table-edit-td"><label class="red">*</label>楼栋数:</td>
                <td align="left" class="l-table-edit-td">
                	<input type="text"  name="model.totalBuilding" id="totalbuilding" value="${model.totalBuilding }" datatype="n" altercss="gray" tip="请填写楼栋数(整数)"/>
                </td>
            	<td align="right" class="l-table-edit-td"><label class="red">*</label>已推盘面积:</td>
                <td align="left" class="l-table-edit-td">
                	<input type="text"  name="model.ytpArea" id="ytparea" value="${model.ytpArea }"
                	 datatype="d" altercss="gray" tip="请填写已推盘面积(数字)"/>平米
                </td>
            </tr>
             <tr>
           	 	<td align="right" class="l-table-edit-td"><label class="red">*</label>已推盘套数:</td>
                <td align="left" class="l-table-edit-td">
                	<input type="text"  name="model.ytpTs" id="ytpts" value="${model.ytpTs }" datatype="d" altercss="gray" tip="请填写已推盘套数(数字)"/>
                </td>
            	<td align="right" class="l-table-edit-td"><label class="red">*</label>已售面积:</td>
                <td align="left" class="l-table-edit-td">
                	<input type="text"  name="model.ysArea" id="ysarea" value="${model.ysArea }" 
                	datatype="d" altercss="gray" tip="请填写已已售面积(数字)"/>平米
                </td>
            </tr>
             <tr>
           	 	<td align="right" class="l-table-edit-td"><label class="red">*</label>已售套数:</td>
                <td align="left" class="l-table-edit-td">
                	<input type="text"  name="model.ysTs" id="ysts" value="${model.ysTs }" datatype="n" altercss="gray" tip="请填写已推盘套数(整数)"/>
                </td>
            	<td align="right" class="l-table-edit-td"><label class="red">*</label>销售均价:</td>
                <td align="left" class="l-table-edit-td">
                	<input type="text"  name="model.averagePrice" id="averageprice" value="${model.averagePrice }" 
                	datatype="d" altercss="gray" tip="请填写销售均价(数字)"/>元
                </td>
            </tr>
            <tr>
            	<td align="right" class="l-table-edit-td"><label class="red">*</label>楼盘介绍:</td>
                <td align="left" class="l-table-edit-td" colspan="3">
                	<textarea name="model.description" id="description" rows="5" style="width: 100%" datatype="s" altercss="gray" tip="请填写楼盘介绍">${ model.description }</textarea>
                </td>
            </tr>
            <tr>
            	<td align="right" class="l-table-edit-td">备注:</td>
                <td align="left" class="l-table-edit-td" colspan="3">
                	<textarea name="model.remark" id="remark" rows="5" style="width: 100%" >${ model.remark }</textarea>
                </td>
            </tr>
        </table>
    </form>
</body>
</html>
